package com.hotdog.controller;

import com.hotdog.pojo.IndexInfo;
import com.hotdog.service.UpLoadService;
import com.hotdog.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;



/**
 * 文件上传controller
 * @author 郭鲁政
 */
@RequestMapping("/upload")
@RestController

@PreAuthorize("hasAuthority('sys:res:list')")
public class UploadController {
    @Autowired
    private UpLoadService upLoadService;

    @GetMapping("/logs")
    public SysResult logs() {
        return upLoadService.logs();

    }

    @PostMapping("/image")

    public SysResult image(MultipartFile file) {
        return upLoadService.uploadImage(file);

    }

    @PostMapping("/view")
    public SysResult view(MultipartFile file) {
        return upLoadService.uploadview(file);

    }
    @PostMapping("/uploadInfo")
    public SysResult uploadInfo (@RequestBody IndexInfo indexInfo){
    return    upLoadService.insertInfo(indexInfo);

    }


}
